package com.lagou.subjectfour;

/**
 * 学生类
 */
public class Student {
    private int num;
    private String name;
    private int age;

    /**
     * 构造函数
     *
     * @param num
     * @param name
     * @param age
     */
    public Student(int num, String name, int age) {
        setNum(num);
        setName(name);
        setAge(age);
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Student student = (Student) o;
        //学号不同  就不同
        if (num != student.num)
            return false;
        else
            return true;
    }

    @Override
    public String toString() {
        return
                "学号：" + num +
                        ", 姓名：" + name +
                        ", 年龄：" + age;
    }

    public int getNum() {
        return num;
    }

    public void setNum(int num) {
        this.num = num;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }
}
